﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using Hartley.ApplicationLogic;
using Hartley.DTOs;

namespace WebApplication1
{
    public partial class viewStudentById : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
            string stdId = Request.QueryString.ToString();
            StudentAL studentAL = new StudentAL();
            if (stdId != "")
            {
                List<StudentDTO> student = studentAL.GetStudentById(new Guid(stdId)).ToList();
                lblStudentFirstName.Text = student.SingleOrDefault().FullName;
                lblStudentDOB.Text = student.SingleOrDefault().DateOfBirth.ToString();
                txtViewStudentPermAdd.Text = student.SingleOrDefault().Address;
                txtViewStudentDescription.Text = student.SingleOrDefault().Description;

                lblStudentEmail.Text = student.SingleOrDefault().EmailAddress;
                lblStudentContactNo.Text = student.SingleOrDefault().ContactNo;
                lblStudentOLYr.Text = student.SingleOrDefault().OrdinaryBatchYear;
                lblStudentDivision.Text = student.SingleOrDefault().Division;
                lblStudentIndexNo.Text = student.SingleOrDefault().IndexNo;
                lblStudentJoinedToCollege.Text = student.SingleOrDefault().StudiedFrom;
                lblStudentLeftCollege.Text = student.SingleOrDefault().StudiedUpTo;
                lblStudentHouse.Text = student.SingleOrDefault().House;
            }
            }
        }
    }
}